<template>
	<div class="reportExamine">
		<Row :gutter="16">
			<i-form :model="formItem" :label-width="150" >
				<i-col span="5">
					<Form-item label="选择校区：" >
						<i-select v-model="formItem.campus" @on-change="changecampus">
							<i-option v-for="item in campus" :value="item.campusName">{{ item.campusName }}</i-option>
						</i-select>
					</Form-item>
				</i-col>
				<i-col span="5">
					<Form-item label="选择部门：">
						<i-select v-model="formItem.department" @on-change="changedepartment">
							<i-option v-for="item in departments" :value="item.name">{{ item.name }}</i-option>
						</i-select>
					</Form-item>
				</i-col>
			</i-form>
		</Row>
		<Row :gutter="16">
			<Card v-for="item in reports">
				<p slot="title">{{item.name}}</p>
				<div class="cardBody">
					<p>Ta的汇报：{{item.workStatement}}</p>
					<hr class="cardBodyHr">
					<p>意见建议：{{item.suggest}}</p>
					<hr class="cardBodyHr">
					<p style="line-height:2">
						<span>部长评价：</span>
						<Input v-model="item.opinion" type="textarea" :rows="3" @on-blur="changeOpinion(item.opinion,item.name)"></Input>
						<Rate  v-model="item.feedback" @on-change="changeRate(item.feedback,item.name)"></Rate>
					</p>
					<hr class="cardBodyHr">
					<p>部长薪资意见：<Input style="width:150px" v-model="item.money" @on-blur="changeMoney(item.money,item.name)"></Input></p>
				</div>
			</Card>
		</Row>
	</div>
</template>

<script>
export default {

	name: 'reportExamine',

	data () {
		return {
			formItem:{
				department:'技术部',
				campus:'屯溪路校区'
			},
			campus: this.$store.state.allCampus,
			departments:this.$store.state.allDepartment,
			reports:[
			{
				name:'邢力',
				workStatement:'1.值班！',
				suggest:'好好学习',
				opinion:'',
				feedback:0,
				money:''
			}
			]
		}
	},
	methods:{
		changedepartment(index){
			console.log(index)
		},
		changecampus(index){
			console.log(index)
		},
		changeOpinion(value,name){
			if(value!==''){
				console.log(value)
			}
		},
		changeRate(value,name){

		},
		changeMoney(value,aname){
			if(value!==''){
				if (value>=0) {
					console.log(value)
				}else{
					this.$Message.error('输入大于0的数字');
					for(let i of this.reports){
						if(i.name==aname){
							i.money=''
						}
					}
				}
			}
		},
	}
}
</script>

<style lang="css" scoped>
.reportExamine{
	width: 100%;
	height: 100%
}
.reportExamine .cardBody{
	font-size: 16px;
	line-height: 28px;
	padding: 0px
}
.cardBodyHr{
	height:7px;
	margin-top: 7px;
	border:none;
	border-top:1px solid #e9eaec;
}
</style>